using System;
using System.Data;
using System.Collections;
using System.Drawing;
using istIUniDB;

namespace Shraga.BLL
{
	[DBFunctions("Shraga_Place.Get_Place", "Shraga_Place.Get_Place_Date")]
	public class Place : DBObject
	{
		#region Data Members

		private Image	 m_imgMap = null;
		
		#endregion

		#region Properties

		public int		 PlaceId		 { get { return base.PrimaryKey;} }
		public String	 PlaceName		 { get { return base.GetStringData("NAME");} }
		public String	 Description	 { get { return base.GetStringData("DESCRIPTION");} }
		public int		 InternetMapId	 { get { return base.GetIntData("INTERNET_MAP_ID");} }
		public int		 SmallRoomCount  { get { return base.GetIntData("SMALL_ROOM_COUNT");} }
		public int		 SmallRoomSits	 { get { return base.GetIntData("SMALL_ROOM_SITS");} }
		public int		 MediumRoomCount { get { return base.GetIntData("MEDIUM_ROOM_COUNT");} }
		public int		 MediumRoomSits  { get { return base.GetIntData("MEDIUM_ROOM_SITS");} }
		public int		 LargeRoomCount  { get { return base.GetIntData("LARGE_ROOM_COUNT");} }
		public int		 LargeRoomSits	 { get { return base.GetIntData("LARGE_ROOM_SITS");} }
		public DateTime  UpdateDate		 { get { return base.LastUpdate;} }
		public bool		 Cancel			 { get { return base.GetBoolData("CANCEL");} }
		public Image	 Map			 
		{ 
			get 
			{ 
				if (m_imgMap == null)
				{
					// TODO : Load the image file
				}

				return m_imgMap; 
			} 
		}		
		
		#endregion		

		#region Constructors

		public Place(int PlaceId)
		: base(PlaceId)
		{}

		#endregion

		#region Public Static Place Methods
		
		public static DataTable GetAllPlaces()
		{
			return UniDBSingleton.Instance().UniDB.RunStoredFunctionReturnDataTable("Shraga_Place.Get_All_Places");			
		}
		
		#endregion
	}
}